import 'package:flutter/material.dart';
import 'package:lib_bt/bean/BleBeanInterface.dart';

///led屏的蓝牙bean类基类
abstract class LedBleBeanInterface extends BleBeanInterface {
  ///获取屏幕宽度
  int get width;

  ///获取屏幕高度
  int get height;

  ///固件版本号
  int get versionCode;

  ///客户id,一个编码值而已
  int get customerId;

  ///屏幕色彩类型
  int get screenColorType;

  ///屏幕类型识别码
  int get screenTypeId;

  Size getSize() {
    return Size(width.toDouble(), height.toDouble());
  }

  ///是否支持自动连接(单备份的设备在强制升级的时候,不需要保存自动连接信息)
  bool isAutoConnect = true;

  ///判断是否是相同的类型
  bool typeIsSame(LedBleBeanInterface bean) {
    var flag = width == bean.width;
    if (flag) {
      flag &= height == bean.height;
    }
    if (flag) {
      flag &= screenColorType == bean.screenColorType;
    }
    if (flag) {
      flag &= screenTypeId == bean.screenTypeId;
    }
    //对比客户id
    if (flag) {
      flag &= customerId == bean.customerId;
    }

    return flag;
  }
}
